package com.fanle.video.controller;

import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.fanle.video.feign.RemoteWebPayService;
import com.fanle.video.param.RechargeOrder;
import com.fanle.video.param.WithdrawOrder;
import com.fanle.video.result.RechargeApplyResult;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

/**
 * @author
 * @date
 * @since 1.0.0
 */
@RestController
@AllArgsConstructor
@RequestMapping("/app")
@Tag(name = "移动端登录模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WebPayController implements RemoteWebPayService {


	@Inner
	@PostMapping("/web/pay/recharge")
	@Override
	public R<RechargeApplyResult> rechargeOrderPay(@RequestBody RechargeOrder rechargeOrder,@RequestHeader(SecurityConstants.FROM) String from) {
		String s = JSONUtil.toJsonStr(rechargeOrder);
		System.out.println(s);
		return null;
	}

	@Inner
	@PostMapping("/web/pay/withdraw")
	@Override
	public R<RechargeApplyResult> withdrawOrderPay(WithdrawOrder withdrawOrder, String from) {
		return null;
	}

	@Inner(value = false)
	@PostMapping("/web/pay/hello")
	public R<String> hello() {
		return R.ok("Hello");
	}
}
